{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "sub_attention = pd.read_csv('./cache/sub_Attention.csv',header=None)\n",
    "sub_cnn = pd.read_csv('./cache/sub_CNN.csv',header=None)\n",
    "sub_rnn = pd.read_csv('./cache/sub_RNN.csv',header=None)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>0</th>\n",
       "      <th>1</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>9a1caf96-681e-3c11-b588-43ac742d7fd2</td>\n",
       "      <td>4.941369</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>82b450db-65c2-351c-84fb-761d76582680</td>\n",
       "      <td>4.524280</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2eec4606-590c-3fa2-b846-7f92441c54a6</td>\n",
       "      <td>4.795393</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>509f9a68-ac41-35ff-9d2e-2fc12f73ed7f</td>\n",
       "      <td>4.331183</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>395f4b22-1c5f-328a-a19d-5065e0530cbc</td>\n",
       "      <td>5.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>6f1202b2-0c1a-3d79-a675-453aad931e3e</td>\n",
       "      <td>4.434727</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>b4bc951f-ce1e-32ae-b27c-bbecba1fd0ee</td>\n",
       "      <td>4.646963</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>30369496-e4b1-30b9-b427-fe23fd1712d6</td>\n",
       "      <td>3.915221</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>704a36e8-47b1-3b93-bb6a-43610c81e1a0</td>\n",
       "      <td>4.457559</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>8a5711e2-b855-3088-adcc-a4d634e2cbb9</td>\n",
       "      <td>4.733935</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                      0         1\n",
       "0  9a1caf96-681e-3c11-b588-43ac742d7fd2  4.941369\n",
       "1  82b450db-65c2-351c-84fb-761d76582680  4.524280\n",
       "2  2eec4606-590c-3fa2-b846-7f92441c54a6  4.795393\n",
       "3  509f9a68-ac41-35ff-9d2e-2fc12f73ed7f  4.331183\n",
       "4  395f4b22-1c5f-328a-a19d-5065e0530cbc  5.000000\n",
       "5  6f1202b2-0c1a-3d79-a675-453aad931e3e  4.434727\n",
       "6  b4bc951f-ce1e-32ae-b27c-bbecba1fd0ee  4.646963\n",
       "7  30369496-e4b1-30b9-b427-fe23fd1712d6  3.915221\n",
       "8  704a36e8-47b1-3b93-bb6a-43610c81e1a0  4.457559\n",
       "9  8a5711e2-b855-3088-adcc-a4d634e2cbb9  4.733935"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sub_rnn[:10]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>0</th>\n",
       "      <th>1</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>9a1caf96-681e-3c11-b588-43ac742d7fd2</td>\n",
       "      <td>4.913296</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>82b450db-65c2-351c-84fb-761d76582680</td>\n",
       "      <td>4.581802</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2eec4606-590c-3fa2-b846-7f92441c54a6</td>\n",
       "      <td>4.592709</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>509f9a68-ac41-35ff-9d2e-2fc12f73ed7f</td>\n",
       "      <td>4.494217</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>395f4b22-1c5f-328a-a19d-5065e0530cbc</td>\n",
       "      <td>5.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>6f1202b2-0c1a-3d79-a675-453aad931e3e</td>\n",
       "      <td>4.587624</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>b4bc951f-ce1e-32ae-b27c-bbecba1fd0ee</td>\n",
       "      <td>4.791191</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>30369496-e4b1-30b9-b427-fe23fd1712d6</td>\n",
       "      <td>3.467049</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>704a36e8-47b1-3b93-bb6a-43610c81e1a0</td>\n",
       "      <td>4.736972</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>8a5711e2-b855-3088-adcc-a4d634e2cbb9</td>\n",
       "      <td>4.781411</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                      0         1\n",
       "0  9a1caf96-681e-3c11-b588-43ac742d7fd2  4.913296\n",
       "1  82b450db-65c2-351c-84fb-761d76582680  4.581802\n",
       "2  2eec4606-590c-3fa2-b846-7f92441c54a6  4.592709\n",
       "3  509f9a68-ac41-35ff-9d2e-2fc12f73ed7f  4.494217\n",
       "4  395f4b22-1c5f-328a-a19d-5065e0530cbc  5.000000\n",
       "5  6f1202b2-0c1a-3d79-a675-453aad931e3e  4.587624\n",
       "6  b4bc951f-ce1e-32ae-b27c-bbecba1fd0ee  4.791191\n",
       "7  30369496-e4b1-30b9-b427-fe23fd1712d6  3.467049\n",
       "8  704a36e8-47b1-3b93-bb6a-43610c81e1a0  4.736972\n",
       "9  8a5711e2-b855-3088-adcc-a4d634e2cbb9  4.781411"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sub_attention[:10]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style>\n",
       "    .dataframe thead tr:only-child th {\n",
       "        text-align: right;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: left;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>0</th>\n",
       "      <th>1</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>9a1caf96-681e-3c11-b588-43ac742d7fd2</td>\n",
       "      <td>4.893415</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>82b450db-65c2-351c-84fb-761d76582680</td>\n",
       "      <td>4.802356</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>2eec4606-590c-3fa2-b846-7f92441c54a6</td>\n",
       "      <td>4.743685</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>509f9a68-ac41-35ff-9d2e-2fc12f73ed7f</td>\n",
       "      <td>5.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>395f4b22-1c5f-328a-a19d-5065e0530cbc</td>\n",
       "      <td>5.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>6f1202b2-0c1a-3d79-a675-453aad931e3e</td>\n",
       "      <td>4.540631</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>b4bc951f-ce1e-32ae-b27c-bbecba1fd0ee</td>\n",
       "      <td>4.524491</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>30369496-e4b1-30b9-b427-fe23fd1712d6</td>\n",
       "      <td>3.537045</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>704a36e8-47b1-3b93-bb6a-43610c81e1a0</td>\n",
       "      <td>4.666284</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>8a5711e2-b855-3088-adcc-a4d634e2cbb9</td>\n",
       "      <td>4.677890</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                      0         1\n",
       "0  9a1caf96-681e-3c11-b588-43ac742d7fd2  4.893415\n",
       "1  82b450db-65c2-351c-84fb-761d76582680  4.802356\n",
       "2  2eec4606-590c-3fa2-b846-7f92441c54a6  4.743685\n",
       "3  509f9a68-ac41-35ff-9d2e-2fc12f73ed7f  5.000000\n",
       "4  395f4b22-1c5f-328a-a19d-5065e0530cbc  5.000000\n",
       "5  6f1202b2-0c1a-3d79-a675-453aad931e3e  4.540631\n",
       "6  b4bc951f-ce1e-32ae-b27c-bbecba1fd0ee  4.524491\n",
       "7  30369496-e4b1-30b9-b427-fe23fd1712d6  3.537045\n",
       "8  704a36e8-47b1-3b93-bb6a-43610c81e1a0  4.666284\n",
       "9  8a5711e2-b855-3088-adcc-a4d634e2cbb9  4.677890"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sub_cnn[:10]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "sub_attention.columns = ['id','score']\n",
    "sub_rnn.columns = ['id','score']\n",
    "sub_cnn.columns = ['id','score']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "sub = pd.DataFrame()\n",
    "sub['id'] = sub_attention['id'].copy()\n",
    "score = (sub_attention.score + sub_rnn.score +sub_cnn.score)/3\n",
    "score[score>4.7] = 5"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "sub[\"score\"] = pd.DataFrame(score)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "sub.to_csv('./cache/final_sub.csv',index=False,header=False)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
